package com.coocaa.internship.controller;

import com.coocaa.internship.common.ResultData;
import com.coocaa.internship.service.serviceImpl.SendMailServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.mail.MessagingException;
/**
 * @author :hhd
 * @Description:
 * @date :2019/8/10 3:37
 */

@Controller
@RequestMapping("/sendMail")
public class SendMailController {

    @Autowired
    SendMailServiceImpl sendMailService;

    @RequestMapping(value = "/simpleMail", method = RequestMethod.GET)
    @ResponseBody
    public ResultData sendSimpleMail() {
        return sendMailService.sendSimpleMail("测试Springboot发送邮件", "发送邮件...");
    }

    @RequestMapping(value = "/attachmentsMail", method = RequestMethod.GET)
    @ResponseBody
    public ResultData sendAttachmentsMail(@RequestParam("userId") Long userId,
                                          @RequestParam("userCvId") Long userCvId,
                                          @RequestParam("companyId") Long companyId) throws MessagingException {
        return sendMailService.sendAttachmentsMail(userId, userCvId, companyId);
    }
}
